package com.yunsom.testdemo.design.absfactory;

import com.yunsom.testdemo.design.absfactory.color.Color;
import com.yunsom.testdemo.design.absfactory.shape.Shape;

/**
 * @author Xbao
 * @version 1.0
 * @description 抽象工厂模式
 * @date 2021/3/9 17:37
 */
public class AbstractFactoryTest {

  public static void main(String[] args) {

    AbstractFactory shapeFactory = FactoryProducer.getFactory("shape");

    Shape shape1 = shapeFactory.getShape("circle");
    shape1.draw();
    Shape shape2 = shapeFactory.getShape("squre");
    shape2.draw();

    AbstractFactory colorFactory = FactoryProducer.getFactory("color");

    Color color1 = colorFactory.getColor("red");
    color1.fill();
    Color color2 = colorFactory.getColor("yellow");
    color2.fill();

  }
}
